import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import Vant from 'vant';
import 'vant/lib/index.css';
import MyCom from './components'
import './style/base.css'
import { uploadInstallReferrerAPI, uploadGogleTokenAPI, uploadInstallIdAPI } from "./api";
import { jiami, jiemi } from "./utils/AESKey";
//使用自己封装的组件
Vue.use(MyCom)
Vue.config.productionTip = false
Vue.use(Vant);
// 挂载全局函数， android调用
window.updateData = function (item) {
    if (item && item.type == 1 && item.token) {
        console.log('111')
        const result = uploadGogleTokenAPI(jiami({ model: item.token || null }))
        console.log(item.token, '谷歌token')
        console.log(JSON.stringify(jiemi(result.data)), '上报谷歌token')
        console.log(result, '上报谷歌token')
    }
    if (item && item.type == 2 && item.id) {
        const result = uploadInstallIdAPI(jiami({ model: item.id || null }))
        console.log(item.id, '第二个id')
        console.log(JSON.stringify(jiemi(result.data)), '上报InstanceId')
        console.log(result, '上报InstanceId')
        console.log('222')
    }
    if (item && item.type == 3) {
        console.log(JSON.stringify(item), 'InstallReferrer')
        const result = uploadInstallReferrerAPI(jiami({ model: item || {} }))
        console.log(JSON.stringify(jiemi(result.data)), '上报InstallReferrer')
        console.log(result, '上报InstallReferrer')
        console.log('333')
    }
}
new Vue({
    router,
    store,
    render: h => h(App)
}).$mount('#app')